
<template>
  <div>
    <el-table
      class="jlTable"
      style="width: 100%"
      :header-cell-style="{ background: '#F2F2F2', color: '#333' }"
      :data="flowOrderTasks"
    >
      <el-table-column type="selection" width="50"></el-table-column>
      <!-- <el-table-column
        label="序号"
        type="index"
        width="100"
        align="center"
      ></el-table-column> -->
      <el-table-column label="任务单ID" width="150">
        <template slot-scope="scope">{{
          scope.row.warningId
        }}</template>
      </el-table-column>
      <el-table-column label="起租操作时间" width="150">
        <template slot-scope="scope">{{ scope.row.taskOprDate }}</template>
      </el-table-column>
      <el-table-column label="起租操作人" width="150">
        <template slot-scope="scope">{{ scope.row.userName }}</template>
      </el-table-column>
      <el-table-column label="预起租确认时间" width="150">
        <template slot-scope="scope">{{ scope.row.taskPlanDate }}</template>
      </el-table-column>
      <el-table-column label="审核意见" width="150">
        <template slot-scope="scope">{{ scope.row.taskComment }}</template>
      </el-table-column>
      <el-table-column label="确认人" width="150">
        <template slot-scope="scope">{{ scope.row.systemUserId }}</template>
      </el-table-column>
      
    </el-table>
    <el-row type="flex" class="row-bg mar-15" justify="center">
      <el-col :span="10">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="pageChange"
          :current-page="parseInt(pageInfo.pageIndex)"
          background
          :page-sizes="[5, 10, 15, 20]"
          :total="parseInt(pageInfo.rowCount)"
          layout="total, sizes, prev, pager, next, jumper"
        ></el-pagination>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import CustOrderService from "@/api/order/CustOrderService";
import OrderService from "@/api/order/OrderService";
export default {
  data() {
    return {
      flowOrderTasks: [],
      pageInfo: {
        pageIndex: "1",
        pageSize: "10",
        pageCount: "0",
        rowCount: "0",
      },
    };
  },
  mounted() {
    this.query();
  },
  props: {
    CTOInfo: {
      type: Object,
    },
  },
  methods: {
    async query() {
      var params = {
        custId: this.CTOInfo.custId,
        orderItemId: this.CTOInfo.orderItemId,
        PayeeAPreFlag:1,
        taskId:"TACHE20350001,TACHE20350002",
        pageInfo: {
          pageIndex: this.pageInfo.pageIndex,
          pageSize: this.pageInfo.pageSize,
        },
      };
      //   params.isExact = this.filterMode;
      //   params.orderItemId=this.CTOInfo.orderItemId;
      //   params.custId=this.CTOInfo.custId;
      //   params.proName = this.productName;
      //   params.current = this.pageIndex;
      //   params.size = this.pageSize;
      

      var result = await CustOrderService.qryOrderTaskList(params);

     
      

      this.flowOrderTasks = result.meta.flowOrderTasks;

     this.pageInfo.pageCount =result.meta.pageInfo.pageCount;
     this.pageInfo.rowCount =result.meta.pageInfo.rowCount;

   
      //this.solutionWarningInfos=;
    },
    //页面改变触发事件
    pageChange(val) {
      
      this.pageInfo.pageIndex = val;
      this.query();
    },
    handleSizeChange(val) {
      
      this.pageInfo.pageSize = val;
      this.query();
    },
    /**
     * 模板下载
     */
    async downClick(val) {
    //    debugger
      var reqMap = {
        fileName: val.fileName,
        filePath: val.filePath,
      };
   
      var res = await OrderService.handelDownFile(reqMap);

      if (res.size > 0) {
        let url = window.URL.createObjectURL(new Blob([res])); //创建下载链接
        let link = document.createElement("a"); //创建a标签
        link.style.display = "none"; //将a标签隐藏
        link.href = url; //给a标签添加下载链接
        link.setAttribute("download", val.tmpName); // 此处注意，要给a标签添加一个download属性，属性值就是文件名称 否则下载出来的文件是没有属性的，空白白
        document.body.appendChild(link);
        link.click(); //执行a标签
      } else {
        this.$confirm(val.fileName + "下载失败!", "提示", {
          confirmButtonText: "确定",
          showCancelButton: false,
          type: "warn",
          center: true,
        });
      }
    },
  },
};
</script>


<style lang="scss">
.el-form--inline .el-form-item {
  display: inline-flex;
  margin-right: 0.1rem;
  vertical-align: top;
  width: 100%;
}
</style>
